package net.wxxr.http.auth;

import net.wxxr.http.request.HttpPostMutipleRequest;
import net.wxxr.http.request.HttpPutMutipleRequest;
import net.wxxr.http.request.HttpPutRequest;
import net.wxxr.http.request.HttpPutUploadByteRequest;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.exception.OAuthCommunicationException;
import oauth.signpost.exception.OAuthExpectationFailedException;
import oauth.signpost.exception.OAuthMessageSignerException;
import oauth.signpost.http.HttpParameters;

import org.apache.http.client.methods.HttpRequestBase;


/**
 * put认证方式
 * @author yuanwenfei
 *
 */
public class PutAuthSign extends BaseAuthSign {

//	HttpPutRequest request;
	HttpPutMutipleRequest request;
//	public PutAuthSign(OAuthConsumer consumer, HttpPutRequest request) {
//		super(consumer);
//		this.request = request;
//	}

	public PutAuthSign(OAuthConsumer consumer,
			HttpPutMutipleRequest httpPutMutipleRequest) {
		// TODO Auto-generated constructor stub
		super(consumer);
		this.request = request;
	}

	@Override
	public void sign(HttpRequestBase requestBase) throws OAuthMessageSignerException, OAuthExpectationFailedException, OAuthCommunicationException {
		if(request != null) {
			HttpParameters bodyParams = request.getBodyParams();
			if(bodyParams != null) {
				consumer.setAdditionalParameters(bodyParams);
			}
		}
		super.sign(requestBase);
	}
	
}
